import java.io.*;

import ift585.tp3.HtmlParserUtility;


public class test {
	
	private String content;
	
	public test(String fileName) throws IOException {
		FileInputStream input = new FileInputStream(new File(fileName));
		
		int oneChar;
		StringBuilder contentBuilder = new StringBuilder();
		
		while((oneChar = input.read()) != -1){
			contentBuilder.append((char)oneChar);
		}
		
		content = contentBuilder.toString();
	}
	
	public void testParsing(){
		HtmlParserUtility parser = new HtmlParserUtility();
		
		String [] resourcesDetected = parser.parseTextContent(content);
		
		for(String oneResources : resourcesDetected){
			System.out.println(oneResources);
		}
	}
	
	public static void main(String[] args) {
		try {
			test oneTest = new test("cplusplus.com - The C++ Resources Network.html");
			oneTest.testParsing();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
